home *** CD-ROM | disk | FTP | other *** search
/ Delphi Magazine Collection 2001 / Delphi Magazine Collection 20001 (2001).iso / DISKS / Issue33 / delcom / XDesktopImpl.pas < prev   
Encoding:
Pascal/Delphi Source File  |  1998-04-11  |  3.3 KB  |  134 lines

  1. unit XDesktopImpl;
  2.  
  3. interface
  4.  
  5. uses
  6.   Windows, ActiveX, Classes, Controls, Graphics, Menus, Forms, StdCtrls,
  7.   ComServ, StdVCL, AXCtrls, AxDesktop_TLB, Desktop;
  8.  
  9. type
  10.   TXDesktop = class(TActiveXControl, IXDesktop)
  11.   private
  12.     { Private declarations }
  13.     FDelphiControl: TDesktop;
  14.     FEvents: IXDesktopEvents;
  15.   protected
  16.     { Protected declarations }
  17.     procedure InitializeControl; override;
  18.     procedure EventSinkChanged(const EventSink: IUnknown); override;
  19.     procedure DefinePropertyPages(DefinePropertyPage: TDefinePropertyPage); override;
  20.     function Get_Font: Font; safecall;
  21.     function Get_ItemCount: Integer; safecall;
  22.     function Get_TextBackgroundColor: TColor; safecall;
  23.     function Get_TextColor: TColor; safecall;
  24. //    function Get_WeenyVisible: WordBool; safecall;
  25.     procedure AboutBox; safecall;
  26.     procedure Set_Font(const Value: Font); safecall;
  27.     procedure Set_ItemCount(Value: Integer); safecall;
  28.     procedure Set_TextBackgroundColor(Value: TColor); safecall;
  29.     procedure Set_TextColor(Value: TColor); safecall;
  30. //    procedure Set_WeenyVisible(Value: WordBool); safecall;
  31.     function Get_Visible: WordBool; safecall;
  32.     procedure Set_Visible(Value: WordBool); safecall;
  33.   end;
  34.  
  35. implementation
  36.  
  37. uses SysUtils, About1;
  38.  
  39. { TXDesktop }
  40.  
  41. procedure TXDesktop.InitializeControl;
  42. begin
  43.   FDelphiControl := Control as TDesktop;
  44.   FDelphiControl.Visible := False;
  45. end;
  46.  
  47. procedure TXDesktop.EventSinkChanged(const EventSink: IUnknown);
  48. begin
  49.   FEvents := EventSink as IXDesktopEvents;
  50. end;
  51.  
  52. procedure TXDesktop.DefinePropertyPages(DefinePropertyPage: TDefinePropertyPage);
  53. begin
  54.   { Define property pages here.  Property pages are defined by calling
  55.     DefinePropertyPage with the class id of the page.  For example,
  56.       DefinePropertyPage(Class_XDesktopPage); }
  57. end;
  58.  
  59. function TXDesktop.Get_Font: Font;
  60. begin
  61.   GetOleFont(FDelphiControl.Font, Result);
  62. end;
  63.  
  64. function TXDesktop.Get_ItemCount: Integer;
  65. begin
  66.   Result := FDelphiControl.ItemCount;
  67. end;
  68.  
  69. function TXDesktop.Get_TextBackgroundColor: TColor;
  70. begin
  71.   Result := FDelphiControl.TextBackgroundColor;
  72. end;
  73.  
  74. function TXDesktop.Get_TextColor: TColor;
  75. begin
  76.   Result := FDelphiControl.TextColor;
  77. end;
  78.  
  79. //function TXDesktop.Get_WeenyVisible: WordBool;
  80. //begin
  81. //  Result := FDelphiControl.Visible;
  82. //end;
  83.  
  84. procedure TXDesktop.AboutBox;
  85. begin
  86.   ShowXDesktopAbout;
  87. end;
  88.  
  89. procedure TXDesktop.Set_Font(const Value: Font);
  90. begin
  91.   SetOleFont(FDelphiControl.Font, Value);
  92. end;
  93.  
  94. procedure TXDesktop.Set_ItemCount(Value: Integer);
  95. begin
  96.   FDelphiControl.ItemCount := Value;
  97. end;
  98.  
  99. procedure TXDesktop.Set_TextBackgroundColor(Value: TColor);
  100. begin
  101.   FDelphiControl.TextBackgroundColor := Value;
  102. end;
  103.  
  104. procedure TXDesktop.Set_TextColor(Value: TColor);
  105. begin
  106.   FDelphiControl.TextColor := Value;
  107. end;
  108.  
  109. //procedure TXDesktop.Set_WeenyVisible(Value: WordBool);
  110. //begin
  111. //  FDelphiControl.Visible := Value;
  112. //end;
  113.  
  114. function TXDesktop.Get_Visible: WordBool;
  115. begin
  116.   Result := FDelphiControl.Visible;
  117. end;
  118.  
  119. procedure TXDesktop.Set_Visible(Value: WordBool);
  120. begin
  121.   FDelphiControl.Visible := Value;
  122. end;
  123.  
  124. initialization
  125.   TActiveXControlFactory.Create(
  126.     ComServer,
  127.     TXDesktop,
  128.     TDesktop,
  129.     Class_XDesktop,
  130.     1,
  131.     '',
  132.     0);
  133. end.
  134.